CSE 373: Data Structures and Algorithms

Winter 2000

Assignment 5 Chapter 6 Due February 18, 2000

 

Please include your name and student id # on what you turn in.

 

  1. Exercise 6.2 (a) (6.2 (a) in C++ book) but only do inserts for the first 10 values (i.e., 10, 12, 1, 14, 6, 5, 8, 15, 3, 9)

 

  1. Exercise 6.3 (6.3 in C++ book)  but only do 2 DeleteMin operations

 

  1. Exercise 6.13 (6.14 in C++ book)

 

  1. Review of some C/C++ operators. From some of the questions I’ve been fielding it is clear that not everyone is familiar with some of the more obscure but still fundamental C/C++ operators.  This question is meant to jog or refresh your memory. 

 

Calculate what the variable X and Y contain after executing each of the following C/C++ code fragments

 

(a)  unsigned long X;

X = 0x65 << 8 | 0x65 >> 4;

 

(b)  unsigned long X;

X = 0xDEADBEEF;

X &= ~(0xF << 12);

 

(c)  unsigned long X;

X = 0xBAADF00D;

X |= (0x11 << 5);

 

(d)  unsigned long X, Y;

X = 0xBAADF00D;

Y = 0xDEADBEEF;

X = X ^ Y;

Y = X ^ Y;

X = X ^ Y;

 

(e)  unsigned long X, Y;

X = 1;

Y = 2;

X = (X < Y ? X : Y) * 2;

 

  1. [Not graded] How much time did you spend on this homework assignment?  On a scale from 1 to 10 (1 being way too easy, 5 being just about right, and 10 being way too hard) how would you rate this for a weekly homework assignment?